
import java.util.Scanner;

public class C_1_13_4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] dp = new int[26];
        for (int i = 0; i < 4; i++) {
            String tmp = sc.nextLine();
            for (int j = 0; j < tmp.length(); j++) {
                if (tmp.charAt(j) >= 'A' && tmp.charAt(j) <= 'Z') {
                    dp[tmp.charAt(j) - 'A']++;
                }
            }
        }
        int max = Integer.MIN_VALUE;
        for (int i = 0; i < 26; i++) {
            max = Math.max(dp[i], max);
        }
        for (int i = max; i > 0; i--) {
            for (int j = 0; j < 26; j++) {
                if(dp[j] >= i){
                    System.out.print("* ");
                }else{
                    System.out.print("  ");
                }
            }
            System.out.println();
        }
        for(int i = 0; i<26; i++){
            char tmp = (char) ('A'+i);
            System.out.print(tmp +" ");
        }

    }
}